Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Crowdin updates #1694

Open
wants to merge 10,000 commits into
base: master
Choose a base branch
from
Open

New Crowdin updates #1694

wants to merge 10,000 commits into from

Conversation

ashkan-deriv
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Apr 22, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to replace the substring check with a more secure method of verifying the hostname. Specifically, we should parse the URL and check if the host matches an allowed list of hosts. This ensures that the check is not bypassed by embedding the allowed host in an unexpected location within the URL.

  1. Parse the URL to extract the hostname.
  2. Check if the hostname matches an allowed list of hosts.
  3. Update the relevant lines in the code to implement this change.
Suggested changeset 1
public/email/crowdin/translations/ar/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/ar/lp-forex-ebook.html b/public/email/crowdin/translations/ar/lp-forex-ebook.html
--- a/public/email/crowdin/translations/ar/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/ar/lp-forex-ebook.html
@@ -490,7 +490,7 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'www.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
                   this.cookie_name = cookie_name
-                  this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
                   this.path = '/'
EOF
@@ -490,7 +490,7 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'www.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
this.cookie_name = cookie_name
this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
this.path = '/'
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to parse the URL and check the host value against a whitelist of allowed hosts. This ensures that the check handles arbitrary subdomain sequences correctly and prevents malicious URLs from bypassing the security check.

  1. Parse the URL to extract the hostname.
  2. Compare the extracted hostname against a whitelist of allowed hosts.
  3. Update the code to use this new approach.
Suggested changeset 1
public/email/crowdin/translations/bn/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/bn/lp-forex-ebook.html b/public/email/crowdin/translations/bn/lp-forex-ebook.html
--- a/public/email/crowdin/translations/bn/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/bn/lp-forex-ebook.html
@@ -490,4 +490,5 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'www.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
EOF
@@ -490,4 +490,5 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'www.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to replace the substring check with a more robust method of verifying the hostname. Specifically, we should parse the URL and check if the hostname matches an allowed list of hosts. This ensures that only the exact allowed hosts are accepted, preventing any bypass attempts.

  1. Parse the URL to extract the hostname.
  2. Use an explicit whitelist of allowed hosts to check if the hostname is valid.
  3. Update the relevant code to implement this change.
Suggested changeset 1
public/email/crowdin/translations/de/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/de/lp-forex-ebook.html b/public/email/crowdin/translations/de/lp-forex-ebook.html
--- a/public/email/crowdin/translations/de/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/de/lp-forex-ebook.html
@@ -490,4 +490,5 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'beta.deriv.com', 'www.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
EOF
@@ -490,4 +490,5 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'beta.deriv.com', 'www.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to replace the substring check with a more robust method of validating the hostname. Specifically, we should parse the URL and check if the hostname matches an allowed list of hosts. This ensures that the check handles arbitrary subdomain sequences correctly and prevents bypassing the validation.

  1. Parse the URL to extract the hostname.
  2. Use an explicit whitelist of allowed hosts to validate the hostname.
  3. Update the relevant lines in the code to implement this change.
Suggested changeset 1
public/email/crowdin/translations/es/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/es/lp-forex-ebook.html b/public/email/crowdin/translations/es/lp-forex-ebook.html
--- a/public/email/crowdin/translations/es/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/es/lp-forex-ebook.html
@@ -490,4 +490,5 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'www.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
EOF
@@ -490,4 +490,5 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'www.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to replace the substring check with a more secure method of validating the hostname. Specifically, we should parse the URL and check if the host is in a whitelist of allowed hosts. This ensures that only the exact allowed hosts or their subdomains are accepted.

  1. Parse the URL to extract the hostname.
  2. Check if the extracted hostname is in a whitelist of allowed hosts.
  3. Replace the substring check with this new validation method.
Suggested changeset 1
public/email/crowdin/translations/fr/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/fr/lp-forex-ebook.html b/public/email/crowdin/translations/fr/lp-forex-ebook.html
--- a/public/email/crowdin/translations/fr/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/fr/lp-forex-ebook.html
@@ -490,7 +490,7 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'beta.deriv.com', 'www.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
                   this.cookie_name = cookie_name
-                  this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
                   this.path = '/'
EOF
@@ -490,7 +490,7 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'beta.deriv.com', 'www.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
this.cookie_name = cookie_name
this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
this.path = '/'
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to ensure that the hostname is properly validated against a whitelist of allowed hosts. This involves parsing the URL to extract the hostname and then checking if it matches any of the allowed hosts. We will use the URL constructor to parse the URL and compare the hostname against a predefined list of allowed hosts.

  1. Parse the URL using the URL constructor to extract the hostname.
  2. Define a whitelist of allowed hosts.
  3. Check if the parsed hostname is in the whitelist.
  4. Update the code to use this secure method for hostname validation.
Suggested changeset 1
public/email/crowdin/translations/id/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/id/lp-forex-ebook.html b/public/email/crowdin/translations/id/lp-forex-ebook.html
--- a/public/email/crowdin/translations/id/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/id/lp-forex-ebook.html
@@ -490,4 +490,5 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'www.deriv.com', 'beta.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
EOF
@@ -490,4 +490,5 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'www.deriv.com', 'beta.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
var deriv_cookie_domain = 'deriv.com' // Modify as per your actual usage
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
deriv.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.

Copilot Autofix AI about 8 hours ago

To fix the problem, we need to parse the URL and check the host value against a whitelist of allowed hosts. This ensures that only legitimate subdomains of deriv.com are accepted. We will use the URL constructor to parse the URL and then check the hostname against a predefined list of allowed hosts.

  1. Parse the URL using the URL constructor.
  2. Extract the hostname from the parsed URL.
  3. Check if the hostname is in the list of allowed hosts.
  4. Update the code to use this new check instead of the substring check.
Suggested changeset 1
public/email/crowdin/translations/it/lp-forex-ebook.html

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/public/email/crowdin/translations/it/lp-forex-ebook.html b/public/email/crowdin/translations/it/lp-forex-ebook.html
--- a/public/email/crowdin/translations/it/lp-forex-ebook.html
+++ b/public/email/crowdin/translations/it/lp-forex-ebook.html
@@ -490,7 +490,7 @@
               var CookieStorage = function (cookie_name, cookie_domain = '') {
-                  var hostname = window.location.hostname
-                  var is_deriv_com = hostname.includes('deriv.com')
+                  var hostname = new URL(window.location.href).hostname
+                  var allowedHosts = ['deriv.com', 'www.deriv.com', 'beta.deriv.com']
+                  var is_deriv_com = allowedHosts.includes(hostname)
                   this.initialized = false
                   this.cookie_name = cookie_name
-                  this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
                   this.path = '/'
EOF
@@ -490,7 +490,7 @@
var CookieStorage = function (cookie_name, cookie_domain = '') {
var hostname = window.location.hostname
var is_deriv_com = hostname.includes('deriv.com')
var hostname = new URL(window.location.href).hostname
var allowedHosts = ['deriv.com', 'www.deriv.com', 'beta.deriv.com']
var is_deriv_com = allowedHosts.includes(hostname)
this.initialized = false
this.cookie_name = cookie_name
this.domain = is_deriv_com ? deriv_cookie_domain : cookie_domain || hostname
this.path = '/'
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant